﻿@model S4Store.Models.FinancialReport.ShyyeHistoryModel
@{
    Layout = null;
    ViewBag.Title = "ShyyeHistory";

    S4Store.Models.Chart.Line ChartModel1 = new S4Store.Models.Chart.Line();
    ChartModel1.Name = "事故车产值历史数据对比";
    ChartModel1.YAxis = "比率(%)";
    
    foreach(var brand in Model.CarBrands){
        S4Store.Models.Chart.ChartSeries series = new S4Store.Models.Chart.ChartSeries();
        series.Name = brand.Name;
        for (DateTime dt = Model.Start; dt <= Model.End; dt = dt.AddMonths(1))
        {
            var report = Model.Reports.FirstOrDefault(t => t.CarBrand.Id == brand.Id && t.Year == dt.Year && t.Month == dt.Month);
            if(report==null){
                report = new S4Store.Domain.FinancialReport.CarBrandFinancialReport();
            }
            series.Data.Add(report.SGCCZZB);
        }
        ChartModel1.Serieses.Add(series);
    }    
    for(DateTime dt=Model.Start;dt<=Model.End;dt=dt.AddMonths(1)){
        ChartModel1.XAxis.Add(dt.ToString("M月"));
    }




    S4Store.Models.Chart.Line ChartModel2 = new S4Store.Models.Chart.Line();
    ChartModel2.Name = "保养产值历史数据对比";
    ChartModel2.YAxis = "比率(%)";

    foreach (var brand in Model.CarBrands)
    {
        S4Store.Models.Chart.ChartSeries series = new S4Store.Models.Chart.ChartSeries();
        series.Name = brand.Name;
        for (DateTime dt = Model.Start; dt <= Model.End; dt = dt.AddMonths(1))
        {
            var report = Model.Reports.FirstOrDefault(t => t.CarBrand.Id == brand.Id && t.Year == dt.Year && t.Month == dt.Month);
            if (report == null)
            {
                report = new S4Store.Domain.FinancialReport.CarBrandFinancialReport();
            }
            series.Data.Add(report.BYCZZB);
        }
        ChartModel2.Serieses.Add(series);
    }
    for (DateTime dt = Model.Start; dt <= Model.End; dt = dt.AddMonths(1))
    {
        ChartModel2.XAxis.Add(dt.ToString("M月"));
    }



    S4Store.Models.Chart.Line ChartModel3 = new S4Store.Models.Chart.Line();
    ChartModel3.Name = "维修产值历史数据对比";
    ChartModel3.YAxis = "比率(%)";

    foreach (var brand in Model.CarBrands)
    {
        S4Store.Models.Chart.ChartSeries series = new S4Store.Models.Chart.ChartSeries();
        series.Name = brand.Name;
        for (DateTime dt = Model.Start; dt <= Model.End; dt = dt.AddMonths(1))
        {
            var report = Model.Reports.FirstOrDefault(t => t.CarBrand.Id == brand.Id && t.Year == dt.Year && t.Month == dt.Month);
            if (report == null)
            {
                report = new S4Store.Domain.FinancialReport.CarBrandFinancialReport();
            }
            series.Data.Add(report.WXCZZB);
        }
        ChartModel3.Serieses.Add(series);
    }
    for (DateTime dt = Model.Start; dt <= Model.End; dt = dt.AddMonths(1))
    {
        ChartModel3.XAxis.Add(dt.ToString("M月"));
    }



    S4Store.Models.Chart.Line ChartModel4 = new S4Store.Models.Chart.Line();
    ChartModel4.Name = "备件销售产值历史数据对比";
    ChartModel4.YAxis = "比率(%)";

    foreach (var brand in Model.CarBrands)
    {
        S4Store.Models.Chart.ChartSeries series = new S4Store.Models.Chart.ChartSeries();
        series.Name = brand.Name;
        for (DateTime dt = Model.Start; dt <= Model.End; dt = dt.AddMonths(1))
        {
            var report = Model.Reports.FirstOrDefault(t => t.CarBrand.Id == brand.Id && t.Year == dt.Year && t.Month == dt.Month);
            if (report == null)
            {
                report = new S4Store.Domain.FinancialReport.CarBrandFinancialReport();
            }
            series.Data.Add(report.BJCZZB);
        }
        ChartModel4.Serieses.Add(series);
    }
    for (DateTime dt = Model.Start; dt <= Model.End; dt = dt.AddMonths(1))
    {
        ChartModel4.XAxis.Add(dt.ToString("M月"));
    }



    S4Store.Models.Chart.Line ChartModel5 = new S4Store.Models.Chart.Line();
    ChartModel5.Name = "装潢销售额历史数据对比";
    ChartModel5.YAxis = "比率(%)";

    foreach (var brand in Model.CarBrands)
    {
        S4Store.Models.Chart.ChartSeries series = new S4Store.Models.Chart.ChartSeries();
        series.Name = brand.Name;
        for (DateTime dt = Model.Start; dt <= Model.End; dt = dt.AddMonths(1))
        {
            var report = Model.Reports.FirstOrDefault(t => t.CarBrand.Id == brand.Id && t.Year == dt.Year && t.Month == dt.Month);
            if (report == null)
            {
                report = new S4Store.Domain.FinancialReport.CarBrandFinancialReport();
            }
            series.Data.Add(report.ZHZB);
        }
        ChartModel5.Serieses.Add(series);
    }
    for (DateTime dt = Model.Start; dt <= Model.End; dt = dt.AddMonths(1))
    {
        ChartModel5.XAxis.Add(dt.ToString("M月"));
    }


    S4Store.Models.Chart.Line ChartModel6 = new S4Store.Models.Chart.Line();
    ChartModel6.Name = "养护产品产值历史数据对比";
    ChartModel6.YAxis = "比率(%)";

    foreach (var brand in Model.CarBrands)
    {
        S4Store.Models.Chart.ChartSeries series = new S4Store.Models.Chart.ChartSeries();
        series.Name = brand.Name;
        for (DateTime dt = Model.Start; dt <= Model.End; dt = dt.AddMonths(1))
        {
            var report = Model.Reports.FirstOrDefault(t => t.CarBrand.Id == brand.Id && t.Year == dt.Year && t.Month == dt.Month);
            if (report == null)
            {
                report = new S4Store.Domain.FinancialReport.CarBrandFinancialReport();
            }
            series.Data.Add(report.YHCPCZZB);
        }
        ChartModel6.Serieses.Add(series);
    }
    for (DateTime dt = Model.Start; dt <= Model.End; dt = dt.AddMonths(1))
    {
        ChartModel6.XAxis.Add(dt.ToString("M月"));
    }
}
<div style="height:100%; width:100%; overflow:auto">
@Html.Action("ReportBar", "Common", Model.BarModel)
<div class="pageContent">
	
	<div class="tabs" currentIndex="0" eventType="click">
		<div class="tabsHeader">
			<div class="tabsHeaderContent">
				<ul>
					<li><a href="javascript:;"><span>事故车产值历史数据对比</span></a></li>
					<li><a href="javascript:;"><span>保养产值历史数据对比</span></a></li>
					<li><a href="javascript:;"><span>维修产值历史数据对比</span></a></li>
					<li><a href="javascript:;"><span>备件销售产值历史数据对比</span></a></li>
					<li><a href="javascript:;"><span>装潢销售额历史数据对比</span></a></li>
					<li><a href="javascript:;"><span>养护产品产值历史数据对比</span></a></li>
				</ul>
			</div>
		</div>
		<div class="tabsContent" >
			<div>
            @Html.Partial("../Chart/Line", ChartModel1)
			</div>
			<div>
            @Html.Partial("../Chart/Line", ChartModel2)
			</div>
            <div>
            @Html.Partial("../Chart/Line", ChartModel3)
			</div>
			<div>
            @Html.Partial("../Chart/Line", ChartModel4)
			</div>
            <div>
            @Html.Partial("../Chart/Line", ChartModel5)
			</div>
            <div>
            @Html.Partial("../Chart/Line", ChartModel6)
			</div>
		</div>
		<div class="tabsFooter">
			<div class="tabsFooterContent"></div>
		</div>
	</div>
</div>

</div>